package April._25.homework.work5;

import java.io.*;
import java.net.Socket;
import java.util.Properties;
import java.util.Scanner;

public class sendTask implements Runnable {
    Socket socket;


    public sendTask(Socket socket) {
        this.socket = socket;
    }

    @Override
    public void run() {
        boolean flag = true;
        Scanner scanner = new Scanner(System.in);
        while (flag) {
            String msg = scanner.nextLine();
            try {
                //获取输出流socket
                OutputStream outputStream = socket.getOutputStream();
                //装换为字符流
                OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream);
                outputStreamWriter.write(msg);
                outputStreamWriter.flush();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }

/*            Properties properties = new Properties();
            try {
                properties.load(new InputStreamReader(new FileInputStream("fileTest/config.properties"), "UTF-8"));
                String recive = properties.getProperty("msg");
                //获取输出流socket
                OutputStream outputStream = socket.getOutputStream();
                //装换为字符流
                OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream);
                outputStreamWriter.write(recive);
                outputStreamWriter.flush();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }*/

        }
    }
}
